Skip to content

Conversation

@anyulled
Copy link
Member

No description provided.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @anyulled, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request focuses on refactoring the codebase by replacing the framer-motion library with @motion/react. This involves updating imports across multiple components and style files to use the new library. Additionally, the pull request updates the package.json and package-lock.json files to reflect the change in dependencies. The useFetchSpeakers.ts file was also updated to include error handling with Sentry and to add the Accept header to the axios get requests.

Highlights

  • Library Replacement: Replaces framer-motion with @motion/react for animation purposes.
  • Import Updates: Updates imports in multiple components and style files to reflect the new library.
  • Dependency Management: Updates package.json and package-lock.json to include @motion/react and remove framer-motion.
  • Error Handling: Implements error handling in useFetchSpeakers.ts using Sentry for reporting exceptions.
  • Axios Configuration: Adds the Accept header to the axios get requests in useFetchSpeakers.ts.

Changelog

Click here to see the changelog
  • package-lock.json
    • Adds motion as a dependency.
    • Updates the resolved URL and integrity hash for motion.
  • package.json
    • Adds motion as a dependency.
  • src/2023/Home/components/Faqs/Faqs.style.ts
    • Replaces import from framer-motion to motion/react.
    • Updates import paths for Color and BIG_BREAKPOINT.
  • src/2023/Home/components/Home/Style.Home.tsx
    • Replaces import from framer-motion to motion/react.
    • Updates import paths for Color and BIG_BREAKPOINT.
  • src/2023/Home/components/SpeakersCarousel/SpeakerSwiper.tsx
    • Updates import paths for Color, ROUTE_SPEAKER_DETAIL, useFetchSpeakers, and useSentryErrorReport.
  • src/2023/SpeakerDetail/Speaker.style.ts
    • Replaces import from framer-motion to motion/react.
    • Updates import paths for Color and breakpoint constants.
  • src/2023/SpeakerDetail/SpeakerDetail.style.ts
    • Replaces import from framer-motion to motion/react.
    • Updates import paths for BIG_BREAKPOINT and Color.
  • src/2023/Speakers/Speakers.style.ts
    • Replaces import from framer-motion to motion/react.
    • Updates import paths for BIG_BREAKPOINT, TABLET_BREAKPOINT, and Color.
  • src/2023/Sponsors/Sponsors.style.ts
    • Replaces import from framer-motion to motion/react.
  • src/2023/TalkDetail/Style.MeetingDetail.tsx
    • Replaces import from framer-motion to motion/react.
    • Updates import paths for BIG_BREAKPOINT, LARGE_BREAKPOINT, and Color.
  • src/2024/Home/Style.Home.tsx
    • Replaces import from framer-motion to motion/react.
    • Updates import paths for Color and breakpoint constants.
  • src/2024/Speakers/Speakers.style.ts
    • Replaces import from framer-motion to motion/react.
    • Updates import paths for BIG_BREAKPOINT, TABLET_BREAKPOINT, and Color.
  • src/2024/Sponsors/Sponsors.style.ts
    • Replaces import from framer-motion to motion/react.
  • src/components/JobOffers/JobsCard.tsx
    • Replaces import from framer-motion to motion/react.
    • Updates import paths for Color, StyledFaqCard, StyledFaqText, StyledFaqTitle, and Offer.
  • src/components/LeftHashWithText/LeftHashWithText.tsx
    • Replaces import from framer-motion to motion/react.
    • Updates import path for MOBILE_BREAKPOINT.
  • src/components/Navigation/Style.Navigation.tsx
    • Replaces import from framer-motion to motion/react.
    • Updates import paths for Color, MAX_WIDTH, and MOBILE_BREAKPOINT.
  • src/components/RightHashWithText/RightHashWithText.tsx
    • Replaces import from framer-motion to motion/react.
    • Updates import path for MOBILE_BREAKPOINT.
  • src/components/Swiper/SpeakersCarousel.tsx
    • Replaces import from framer-motion to motion/react.
    • Updates import path for LessThanBlueWhiteIcon.
  • src/components/YearSpecific/Speakers/Speakers.style.ts
    • Replaces import from framer-motion to motion/react.
    • Updates import paths for breakpoint constants and Color.
  • src/hooks/useFetchSpeakers.test.tsx
    • Adds import for Sentry.
    • Mocks Sentry.
    • Adds tests for handling network errors, CORS errors, and empty responses.
    • Adds Accept header to the axios get requests.
  • src/hooks/useFetchSpeakers.ts
    • Adds import for Sentry.
    • Adds try-catch block to handle errors and report to Sentry.
    • Adds the Accept header to the axios get requests.
  • src/hooks/useFetchTalks.test.tsx
    • Updates the type of mockedAxios to MockedFunction.
  • src/views/Home/HomeWrapper.tsx
    • Sets the sessionizeUrl to 'default'.
  • src/views/Home/components/Faqs/Faqs.style.ts
    • Replaces import from framer-motion to motion/react.
    • Updates import paths for Color and BIG_BREAKPOINT.
  • src/views/Home/components/Home/Style.Home.tsx
    • Replaces import from framer-motion to motion/react.
    • Updates import paths for Color and breakpoint constants.
  • src/views/Home/components/Sponsors/Sponsors.style.ts
    • Replaces import from framer-motion to motion/react.
  • src/views/MeetingDetail/Style.MeetingDetail.tsx
    • Replaces import from framer-motion to motion/react.
    • Updates import paths for breakpoint constants and Color.
    • Fixes style formatting issues.
  • src/views/SpeakerDetail/Speaker.style.ts
    • Replaces import from framer-motion to motion/react.
    • Updates import paths for Color and breakpoint constants.
  • src/views/SpeakerDetail/SpeakerDetail.style.ts
    • Replaces import from framer-motion to motion/react.
    • Updates import paths for BIG_BREAKPOINT and Color.
  • src/views/Speakers/Speakers.style.ts
    • Replaces import from framer-motion to motion/react.
    • Updates import paths for BIG_BREAKPOINT, TABLET_BREAKPOINT, and Color.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


In realms of code, where motions flow,
A shift occurs, a vibrant show.
Framer's embrace, now set aside,
Motion/React, a graceful stride.
Animations bloom, a lively glow.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request replaces framer-motion with @motion/react and updates imports accordingly. The changes seem straightforward and address the intended refactoring. However, there are a few areas where improvements can be made, particularly in the useFetchSpeakers.ts file regarding error handling and consistency in test assertions.

Summary of Findings

  • Error Handling in useFetchSpeakers: The useFetchSpeakers hook returns an empty object {} upon error, which can lead to unexpected behavior. Returning an empty array [] is recommended for type consistency.
  • Inconsistent Import Order: The order of imports styled and keyframes from styled-components is not consistent across files. While functionally correct, maintaining a consistent order improves readability.
  • Redundant Curly Braces in CSS: The curly braces around CSS properties in StyledExtraInfo and StyledNameContainer in src/views/MeetingDetail/Style.MeetingDetail.tsx are redundant and can be removed for cleaner code.

Merge Readiness

The pull request is almost ready for merging. Addressing the error handling in useFetchSpeakers and ensuring consistent return types is crucial. The other comments are minor and can be addressed at the author's discretion. I am unable to directly approve this pull request, and recommend that others review and approve this code before merging.

Comment on lines +2 to +3
import { Color } from "@styles/colors";
import { motion } from "motion/react";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider using a direct import from the motion package instead of motion/react if the component is intended to be used outside of React components. This might provide more flexibility and avoid unnecessary dependencies if the core animation logic is needed elsewhere.

Suggested change
import { Color } from "@styles/colors";
import { motion } from "motion/react";
import { Color } from "@styles/colors";
import { motion } from "motion";

import { motion } from "framer-motion";
import { Color } from "../../styles/colors";
import { BIG_BREAKPOINT, BIGGER_BREAKPOINT } from "../../constants/BreakPoints";
import { motion } from "motion/react";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider using a direct import from the motion package instead of motion/react if the component is intended to be used outside of React components. This might provide more flexibility and avoid unnecessary dependencies if the core animation logic is needed elsewhere.

Suggested change
import { motion } from "motion/react";
import { motion } from "motion";

import LessThanBlueWhiteIcon from "../../assets/images/LessThanBlueIcon.svg";
import { motion } from "framer-motion";
import LessThanBlueWhiteIcon from "@assets/images/LessThanBlueIcon.svg";
import { motion } from "motion/react";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider using a direct import from the motion package instead of motion/react if the component is intended to be used outside of React components. This might provide more flexibility and avoid unnecessary dependencies if the core animation logic is needed elsewhere.

import { motion } from "motion";

return speakerAdapter(returnData);
} catch (e) {
Sentry.captureException(e);
return {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Returning an empty object {} might not be the best approach for handling errors. It could lead to unexpected behavior in components that consume this data. Consider returning an empty array [] to maintain type consistency and avoid potential issues when mapping over the data or accessing its properties.

      Sentry.captureException(e);
      return [];

Comment on lines 17 to +18
const mockedAxios = axios as jest.Mocked<typeof axios>;
const mockedSentry = vi.mocked(Sentry);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

It's good to mock external dependencies like axios and Sentry. However, ensure that the mocked Sentry instance is used in the tests to verify that errors are indeed captured when expected. Consider adding assertions to check if mockedSentry.captureException is called with the correct error in the error handling tests.

Suggested change
const mockedAxios = axios as jest.Mocked<typeof axios>;
const mockedSentry = vi.mocked(Sentry);
const mockedAxios = axios as jest.Mocked<typeof axios>;
const mockedSentry = { captureException: vi.fn() };
vi.mock('@sentry/react', () => ({ captureException: mockedSentry.captureException }));

Comment on lines 179 to 180
expect(mockedSentry.captureException).toHaveBeenCalledWith(networkError);
expect(result.current.data).toEqual({});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Returning an empty object {} from the hook when an error occurs can lead to issues in components consuming the data. Consider returning an empty array [] instead to maintain type consistency. Update the assertion to reflect this change.

Suggested change
expect(mockedSentry.captureException).toHaveBeenCalledWith(networkError);
expect(result.current.data).toEqual({});
expect(mockedSentry.captureException).toHaveBeenCalledWith(networkError);
expect(result.current.data).toEqual([]);

Comment on lines 200 to 201
expect(mockedSentry.captureException).toHaveBeenCalledWith(corsError);
expect(result.current.data).toEqual({});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Returning an empty object {} from the hook when an error occurs can lead to issues in components consuming the data. Consider returning an empty array [] instead to maintain type consistency. Update the assertion to reflect this change.

Suggested change
expect(mockedSentry.captureException).toHaveBeenCalledWith(corsError);
expect(result.current.data).toEqual({});
expect(mockedSentry.captureException).toHaveBeenCalledWith(corsError);
expect(result.current.data).toEqual([]);

@netlify
Copy link

netlify bot commented May 14, 2025

Deploy Preview for dev-bcn ready!

Name Link
🔨 Latest commit bb9add7
🔍 Latest deploy log https://app.netlify.com/sites/dev-bcn/deploys/68247457a026e900086d0fb8
😎 Deploy Preview https://deploy-preview-709--dev-bcn.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 43
Accessibility: 100
Best Practices: 92
SEO: 100
PWA: 90
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 75%)
4.1% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@anyulled anyulled merged commit e94d7b5 into main May 14, 2025
13 of 14 checks passed
@anyulled anyulled deleted the fix/fix-home-swiper branch May 14, 2025 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants